// 加载FORM表单扩展
layui.use(['form', 'laydate'], function(){
    var form = layui.form()
        ,layer = layui.layer,
        laydate = layui.laydate;

    //自定义验证规则
    form.verify({

    });
    var laydate = layui.laydate;

    var start = {
        min: laydate.now()
        ,max: '2099-06-16 23:59:59'
        ,istoday: false
        ,choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };

    var end = {
        min: laydate.now()
        ,max: '2099-06-16 23:59:59'
        ,istoday: false
        ,choose: function(datas){
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };

    document.getElementById('LAY_demorange_s').onclick = function(){
        start.elem = this;
        laydate(start);
    }
    document.getElementById('LAY_demorange_e').onclick = function(){
        end.elem = this
        laydate(end);
    }
    //监听提交
    $("#ssss").click(function (data) {
        alert(2);
    });
    form.on('submit(submit)', function(data){
        alert(2);
        var formData = data.field;
        console.log(formData);
        $.ajax({
            type:"POST",
            url:'Report/code_Statistics',
            dataType:"json",
            data:postData,
            success: function(data){
                if(data.status == 'success') {
                    PopModel.refreshParentFrame();
                } else {
                    layer.msg(data.msg, {icon: 5, shift: 6}, function(){});
                }
                return false;
            }
        });

        return false;
    });

    // 刷新表单
    form.render();
});